using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class RepairMap : EntityTypeConfiguration<Repair>
    {
        public RepairMap()
        {
            // Primary Key
            this.HasKey(t => t.id);

            // Properties
            this.Property(t => t.id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Customer_name)
                .HasMaxLength(50);

            this.Property(t => t.Customer)
                .HasMaxLength(6);

            this.Property(t => t.ToolType)
                .HasMaxLength(10);

            this.Property(t => t.ToolSerial)
                .HasMaxLength(20);

            this.Property(t => t.DeliveryAddress)
                .HasMaxLength(50);

            this.Property(t => t.BillingAddress)
                .HasMaxLength(50);

            this.Property(t => t.Contact)
                .HasMaxLength(50);

            this.Property(t => t.Salesman)
                .HasMaxLength(50);

            this.Property(t => t.OldTool_)
                .HasMaxLength(20);

            this.Property(t => t.Number)
                .HasMaxLength(20);

            this.Property(t => t.RPR_Phone)
                .HasMaxLength(20);

            this.Property(t => t.RPR_Mobile)
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("Repair");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.Customer_name).HasColumnName("Customer_name");
            this.Property(t => t.Customer).HasColumnName("Customer");
            this.Property(t => t.mechanic1).HasColumnName("mechanic1");
            this.Property(t => t.mechanic2).HasColumnName("mechanic2");
            this.Property(t => t.RepairType).HasColumnName("RepairType");
            this.Property(t => t.DamageKind).HasColumnName("DamageKind");
            this.Property(t => t.TopStopApproval).HasColumnName("TopStopApproval");
            this.Property(t => t.ApprovalDate).HasColumnName("ApprovalDate");
            this.Property(t => t.WarrantyApproved).HasColumnName("WarrantyApproved");
            this.Property(t => t.ToolType).HasColumnName("ToolType");
            this.Property(t => t.ToolSerial).HasColumnName("ToolSerial");
            this.Property(t => t.Note).HasColumnName("Note");
            this.Property(t => t.RequestDate).HasColumnName("RequestDate");
            this.Property(t => t.QuotationDate).HasColumnName("QuotationDate");
            this.Property(t => t.QuotationProposed).HasColumnName("QuotationProposed");
            this.Property(t => t.CustomerApproval).HasColumnName("CustomerApproval");
            this.Property(t => t.InDate).HasColumnName("InDate");
            this.Property(t => t.OutDate).HasColumnName("OutDate");
            this.Property(t => t.AssemblingTime).HasColumnName("AssemblingTime");
            this.Property(t => t.DisAssemblingTime).HasColumnName("DisAssemblingTime");
            this.Property(t => t.Amount).HasColumnName("Amount");
            this.Property(t => t.Repaired).HasColumnName("Repaired");
            this.Property(t => t.DeliveryDate).HasColumnName("DeliveryDate");
            this.Property(t => t.Delivered).HasColumnName("Delivered");
            this.Property(t => t.DeliveryAddress).HasColumnName("DeliveryAddress");
            this.Property(t => t.BillingAddress).HasColumnName("BillingAddress");
            this.Property(t => t.Contact).HasColumnName("Contact");
            this.Property(t => t.Salesman).HasColumnName("Salesman");
            this.Property(t => t.PurchaseDate).HasColumnName("PurchaseDate");
            this.Property(t => t.CustomerInformedDate).HasColumnName("CustomerInformedDate");
            this.Property(t => t.OldTool_).HasColumnName("OldTool#");
            this.Property(t => t.Number).HasColumnName("Number");
            this.Property(t => t.RPR_OneTimeCust).HasColumnName("RPR_OneTimeCust");
            this.Property(t => t.RPR_Phone).HasColumnName("RPR_Phone");
            this.Property(t => t.RPR_Mobile).HasColumnName("RPR_Mobile");
        }
    }
}
